1. Field of the Invention
The present invention relates, generally, to the logging of messages from an adapter card in a host computer and, in one embodiment, to a system and method for dynamically adjusting the rate of message buffer processing in response to message buffer consumption to reduce the probability of message buffer overruns, while at the same time preserving memory and lowering processor utilization.
2. Description of Related Art
Host bus adapters (HBAs) are input/output (I/O) adapters that connect a host computer's bus and an outside network such as a Fibre Channel loop. HBAs manage the transfer of information between the bus and the outside network. HBAs are typically implemented in circuit cards that can be plugged into the backplane of the host computer. For example, a HBA can be inserted into a connector which interfaces to the Peripheral Component Interconnect (PCI) bus of a host computer to enable the host computer to communicate with a storage area network (SAN) using, for example, fibre channel or Internet Small Computer System Interface (iSCSI) protocols.
During the course of HBA operation, status, debug, error or other types of messages may be generated by firmware in the HBA. For example, status messages may be generated when its state changes, or a sequence of detailed debug messages may be generated as the firmware attempts to connect to a target device. Each step of the connection process can be monitored if the firmware is configured for that type of message logging. Error messages may also be generated when a connection to a storage device has failed or has terminated unexpectedly.
It is often beneficial for the host computer to log (store) these messages for subsequent troubleshooting, for example. Thus, some HBAs provide a message logging capability for storing certain messages at the host computer. Without this capability, messages generated in the HBA could not be stored in the host computer disk file for subsequent retrieval by an operator. The number of messages logged by the host computer depends on a predetermined logging level. In other words, although many messages may be generated by the HBA, only certain types of messages are typically logged.
Although in theory all messages generated by the HBA could be logged, in practice this is not the case. Restrictions on message logging may be imposed by the operating system of the host computer. For example, Microsoft's Windows® operating system provides a system event log for logging messages from a mini-port driver for an adapter card, but Microsoft only provides for the logging of a prescribed set of events (messages) that affect the host computer. The Windows system event log records events that are of interest to the Windows® Operating System, such as the successful startup of a driver, the failure of a driver to start, or a fatal condition encountered by a driver. However, Microsoft does not provide for the logging of vendor-specific events (i.e. events specific to a HBA card).
In computers employing a system event log, when the driver for a HBA recognizes an event that can be logged, the driver makes a call to the operating system (OS), telling the OS to log the message for the driver. The messages must correspond to a predefined event number assigned by Microsoft. The OS writes the messages to a disk file at its convenience, because these messages are often created during startup when the disk drive may not be available (i.e., still spinning up to speed).
Another message logging restriction imposed by the operating system is related to the allocation of memory for storing messages. For example, Microsoft's Windows® operating system only allows a device driver to allocate memory for itself at system startup. At that time, the device driver must estimate or otherwise request a memory allocation, and thereafter is stuck with this initial allocation. Microsoft also discourages developers of device drivers not to waste memory by allocating too much memory at startup. With the memory size restricted, if the HBA attempts to log too many messages, buffer overruns will occur and messages will be lost.
Thus, a need exists for a system which is able to efficiently log messages from a HBA and minimize the number of messages lost, while avoiding the limitations imposed by operating systems such as Microsoft's Windows® operating system.